import request from '@/utils/request.js'

/**
 * 获取学生信息
 * @returns
 */
export const getStuInfoAPI = (id) => {
  return request.get('/user/studentInfo', { params: { id } })
}

/**
 * 获取操作日志
 * @param {*} data
 * @returns
 */
export const getStuLogAPI = (data) => {
  return request.get('/user/stuLog', { params: data })
}

/**
 * 修改学生资料
 * @param {*} val
 * @returns
 */
export const updateStuDataAPI = (data) => {
  return request.patch('/user/updateStudent', data)
}

/**
 * 修改手机号
 * @param {*} data
 * @returns
 */
export const updateStuPhoneAPI = (data) => {
  return request.patch('/user/updatePhone', data)
}

/**
 * 修改密码
 * @param {*} param0
 * @returns
 */
export const updatePasswordAPI = ({ oldPassword, newPassword }) => {
  return request.patch('/user/updatePassword', { oldPassword, newPassword })
}

/**
 * 学生添加班级
 * @param {*} classNode
 * @returns
 */
export const addClassAPI = (classNode) => {
  return request.post('/user/addClass', {
    studentId: localStorage.getItem('uid'),
    classNode: classNode
  })
}

/**
 * 上传图片
 * @param {*} file
 * @returns
 */
export const uploadAvatar = (file) => {
  return request.post('/user/uploadAvatar', file)
}

/**
 * 获取考生ip地址
 * @returns
 */
export const getIPAddressAPI = () => {
  return request.get('/user/getIPAddress')
}

/**
 * 获取用户人脸特征信息
 * @returns
 */
export const getFaceInfoAPI = () => {
  return request.get('/user/getFaceInfo')
}

/**
 * 更新用户人脸特征信息
 * @param {*} body
 * @returns
 */
export const updateFaceInfoAPI = (body) => {
  return request.patch('/user/updateFaceInfo', body)
}

/**
 * 上传人脸照片
 * @param {*} data
 * @returns
 */
export const updateFaceImageAPI = (data) => {
  return request.post('/user/uploadFaceImage', data)
}
